#ifndef	__GRAPHICS_H__
#define	__GRAPHICS_H__

#include "Direct3D.h"
#include "Camera.h"
#include "bumpmapshaderclass.h"
#include "lightclass.h"
#include "modelclass.h"
#include "textclass.h"
#include "Input.h"
#include "sceneclass.h"
#include "sceneshaderclass.h"
#include "rendertextureclass.h"
#include "TextureMgr.h"
#include "skyclass.h"
#include "skyshaderclass.h"
#include "poolclass.h"
#include "poolshaderclass.h"

class Graphics
{
public:
	Graphics();
	Graphics(const Graphics&);
	~Graphics();

	bool Initialize(int screenWidth, int screenHeight, HWND hwnd, HWND hdlg, Input* input,
		bool vsync, bool fullscreen, float screenDepth, float screenNear);
	void Shutdown();
	bool Frame(int fps, int cpu, float frameTime, float fTime);
	void SetParam(UINT uReflect, UINT uNoise, UINT uNoiseUnder, UINT uNormal, UINT uRefract,
		UINT uShadow, UINT uLightRotate, UINT uTeapotRotate, float fAlpha[24], float fXYZ[3]);
private:
	bool Render(float rotation, float fTime, int iFps);
	void UpdateWaveMapOffect(float fTime);
	void UpdateInput(float fTime);
	void RenderToTexture(float fTime);
	void RenderScene(D3DXMATRIX viewMatrix, D3DXMATRIX proj, bool bNeedClip, float rotation);
	void RenderSky(D3DXMATRIX viewMatrix, D3DXMATRIX proj);
	bool SetFps(int iFps);

private:
	HWND m_hDlg;
	Direct3D* m_D3D;

	Camera* m_Camera;
	ModelClass* m_Model;

	LightClass* m_Light;
	SceneClass* m_Scene;
	SkyClass* m_Sky;
	SkyShaderClass* m_SkyShader;
	PoolClass* m_Pool;
	PoolShaderClass*		m_PoolShader;

	PoolClass* m_Pool2;
	PoolShaderClass*		m_PoolShader2;

	BumpMapShaderClass* m_BumpMapShader;
	SceneShaderClass* m_SceneShader;

	//TextClass* m_Text;
	D3DXVECTOR2				m_waveMapOffset0;
	D3DXVECTOR2				m_waveMapOffset1;
	Input*		m_pInput;
	int	m_iPreMouseX;
	int	m_iPreMouseY;

	RenderTextureClass* m_RenderTexture;
	ID3DX10Font*	m_Font;

	//////////////////////////////////////////////////////////////////////////
	UINT m_uReflect;
	UINT m_uNoise;
	UINT m_uNoiseUnder;	
	UINT m_uRefract;
	UINT m_uNormal;
	UINT m_uShadow;
	UINT m_uLightRotate;
	UINT m_uTeapotRotate;

	bool m_bFULL_SCREEN;
	bool m_bVSYNC_ENABLED;
	float SCREEN_DEPTH;
	float SCREEN_NEAR;

};

#endif
